Skip to content

[btc-hardening][kyoto] migrate to upstream bip157 v0.5.0#488

Merged
0xsiddharthks merged 4 commits intomainfrom
siddharth/kyoto-upgrade
Apr 28, 2026
Merged

[btc-hardening][kyoto] migrate to upstream bip157 v0.5.0#488
0xsiddharthks merged 4 commits intomainfrom
siddharth/kyoto-upgrade

Conversation

@0xsiddharthks
Copy link
Copy Markdown
Contributor

@0xsiddharthks 0xsiddharthks commented Apr 26, 2026

Replace our kyoto dependency from my fork of the 2140-dev/kyoto repo with the latest official release.

@0xsiddharthks 0xsiddharthks requested a review from bmwill as a code owner April 26, 2026 21:41
@0xsiddharthks 0xsiddharthks marked this pull request as draft April 26, 2026 21:47
@0xsiddharthks 0xsiddharthks marked this pull request as ready for review April 27, 2026 21:45
@0xsiddharthks 0xsiddharthks changed the title [kyoto] migrate to upstream bip157 v0.5.0 [1/n][btc-hardening][kyoto] migrate to upstream bip157 v0.5.0 Apr 27, 2026
@0xsiddharthks 0xsiddharthks changed the title [1/n][btc-hardening][kyoto] migrate to upstream bip157 v0.5.0 [btc-hardening][kyoto] migrate to upstream bip157 v0.5.0 Apr 27, 2026
Copy link
Copy Markdown
Contributor

@Bridgerz Bridgerz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0xsiddharthks 0xsiddharthks force-pushed the siddharth/kyoto-upgrade branch from a78332b to d95266e Compare April 28, 2026 19:46
@0xsiddharthks 0xsiddharthks enabled auto-merge (squash) April 28, 2026 19:47
Replace the 0xsiddharthks/kyoto fork (siddharth/upgrades, rev f2ba601c)
with crates.io bip157 = "0.5.0". All four features the fork carried
landed upstream:

  - get_header(height)            -> PR #563
  - height_of_hash(hash)          -> PR #564 (canonical-only semantics)
  - whitelist_only()              -> PR #565 folded into #567
  - hostname trusted peers        -> PR #566 (redesigned in review)

Adapt to upstream's API changes:

  - DnsPeer removed. Use TrustedPeer::from_hostname(host, port) and the
    Builder::add_peer{,s} APIs over TrustedPeer instead of the old
    add_dns_peer{,s}.
  - Note v0.5.0 consumes hostname peers on use (popped from the
    whitelist when first tried, never reinstated). Re-resolution
    requires rebuilding the kyoto node, which our connectivity
    supervisor already does on consecutive failures.
  - broadcast_tx renamed to submit_package(impl Into<Package>). We
    pass a Transaction directly via the From<Transaction> for Package
    impl, so the call site is a one-line rename with the same return
    type (Wtxid).

Requester::height_of_hash now returns None for non-canonical hashes
(canonical-only via #564). The hashi call site already treats Ok(None)
as "block not on canonical chain" so this tightens correctness for
free with no behavior change. Soften the surrounding warn from
"possibly malicious" to acknowledge sync lag and recent reorgs as the
more common explanations.

We also inherit BIP-130 sendheaders, the new/tried peer fallback fix,
the late-CF-header ban fix, plus rescan_from(height), chain_tip(),
peer_info(), and Package::new_one_parent_one_child for future use.
- Promote kyoto/bip157 to [workspace.dependencies] for consistency
- Trim doc comments back toward pre-PR style
- Tighten the warn! when bitcoind reports a hash kyoto hasn't seen yet
* [kyoto] tighten supervisor restart threshold to 15 failures
@0xsiddharthks 0xsiddharthks force-pushed the siddharth/kyoto-upgrade branch from d95266e to 0aad2f8 Compare April 28, 2026 20:57
bip157 v0.5.0 pops hostname trusted peers from the whitelist on use,
so a single peer drop ends the kyoto Node task with NoReachablePeers.
The event loop kept waiting on now-silent kyoto channels while
client_rx accepted deposits, so deposits stalled indefinitely (CI
test_large_withdrawal_signature_chunking confirmed only 27/500 over
600s; see kyoto Failed to look up block ... receiver was dropped).

Race the event loop against the kyoto JoinHandle so any exit (Ok,
NodeError, or panic) routes into the existing rebuild path.
@0xsiddharthks 0xsiddharthks merged commit e65d79e into main Apr 28, 2026
9 checks passed
@0xsiddharthks 0xsiddharthks deleted the siddharth/kyoto-upgrade branch April 28, 2026 21:36
zhouwfang pushed a commit that referenced this pull request Apr 30, 2026
* [kyoto] migrate to upstream bip157 v0.5.0

Replace the 0xsiddharthks/kyoto fork (siddharth/upgrades, rev f2ba601c)
with crates.io bip157 = "0.5.0".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants